{{template "header" .}}	
	<title>修改文章</title>
</head>
<body>
{{template "navigation" .}}	
<div class="container" style="margin-top:100px">
	<h1>修改文章</h1>
	<form method="POST" action="/topic">
		<div class="form-group">
			<label>文章标题</label>
			<input id="title" class="form-control" type="text" name="TopicTitle" value="{{.Topic.Title}}">
		</div>
		<div class="form-group">
			<label>文章分类</label>
			<input id="category" class="form-control" type="text" name="TopicCategory" value="{{.Topic.Category}}">
		</div>
		<div class="form-group">
			<label>文章标签</label>
			<input id="label" class="form-control" type="text" name="TopicLabel" readonly="true" value="{{.Labels}}">
		</div>
		<div class="form-group">
			<label>文章内容</label>
			<!--br></br-->
			<textarea rows="10" cols="30" class="form-control" name="TopicContent">{{.Topic.Content}}</textarea>
			<!--input id="content" class="form-control" type="text" name="Content"-->
		</div>
		<input type="hidden" name="TopicId" value="{{.TopicId}}"/>
		<button class="btn-default" type="submit" onclick="return checkinput()">提交</button>
		<button class="btn-default" onclick="return backtohome()">返回</button>
	</form>
	<script type="text/javascript">
		function checkinput(){
			var name = document.getElementById("title");
			if (name.value.length == 0){
				alert("请输入标题");
				return false;
			}
			var cate = document.getElementById("category");
			if (cate.value.length == 0){
				alert("请输入分类");
				return false;
			}
			var content = document.getElementById("content");
			if (content.value.length == 0){
				alert("请输入内容");
				return false;
			}

			return true;
		}
		function backtohome(){
			window.location.href = "/topic";
			return false;
		}
	</script>
</div>
</body>
</html>


